
#ifndef DESIGN_PATTERNS_MEDIATOR_MERCHANT_H
#define DESIGN_PATTERNS_MEDIATOR_MERCHANT_H

#include "Message.h"
#include "Commodity.h"
#include <string>
#include <vector>

class Platform;

class Merchant
{
protected:
  int mid_;
  Commodity commodity_;
  Platform* platform_;

public:
  Merchant(int mid, Commodity com, Platform* platform = nullptr);

  int git_mid() const;

  Commodity& Sell();

  void set_platform(Platform* platform);

  bool Send(int receiver, std::string msg);

  virtual void Receive(const Message& msg) = 0;

  // 商家不应该析构指向platform的指针
  virtual ~Merchant() = default;
};

#endif //DESIGN_PATTERNS_MEDIATOR_MERCHANT_H
